﻿#ifndef CUSTOM_LIGHTING_INCLUDED
#define CUSTOM_LIGHTING_INCLUDED

//获取 Incoming Light
float3 IncomingLight(Surface surface,Light light)
{
    return saturate(dot(surface.normal,light.direction)) * light.color;
}

//获取光照计算结果
float3 GetLighting(Surface surface,BRDF brdf,Light light)
{
    //return IncomingLight(surface,light) * surface.color; // = dot(n,l) * lit_color * surface_color（Lambert's law）
    return IncomingLight(surface,light) * DirectBRDF(surface,brdf,light);
}
//获取光照计算结果
float3 GetLighting(Surface surface,BRDF brdf)
{
    float3 color = 0.0;
    for(int i = 0; i < GetDirectionalLightCount(); i++)
    {
        color += GetLighting(surface,brdf,GetDirectionalLight(i));
    }
    return color;
}



#endif